package main

import (
	"container/list"
)

func Remove(v interface{}, l *list.List) bool {
	if v == nil {
		for e := l.Front(); e != nil; e = e.Next() {
			if e.Value == nil {
				l.Remove(e)
				return true
			}
		}
	} else {
		for e := l.Front(); e != nil; e = e.Next() {
			if e.Value == v {
				l.Remove(e)
				return true
			}
		}
	}

	return false
}
